using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using PBMessage;
public class PBIDMapping 
{
   public IPBHandler HandlerClass;
   public System.Type HandlerType;
   public PBIDMapping(IPBHandler c,System.Type t) 
   {
       HandlerClass = c;
       HandlerType = t;
   }
} 
public class PacketHandlersDic
{
    private Dictionary<PBMessageID, PBIDMapping> Handlers = new Dictionary<PBMessageID, PBIDMapping>();

   public void LoadHandlers() 
   {
       PBIDMapping SC_LoginMapping = new PBIDMapping(new SC_Login_Handler(),typeof(SC_Login));
    this.Handlers.Add(PBMessageID.SC_Login,SC_LoginMapping);
    PBIDMapping SC_RegAccountMapping = new PBIDMapping(new SC_RegAccount_Handler(),typeof(SC_RegAccount));
    this.Handlers.Add(PBMessageID.SC_RegAccount,SC_RegAccountMapping);
    PBIDMapping SC_HallTickMapping = new PBIDMapping(new SC_HallTick_Handler(),typeof(SC_HallTick));
    this.Handlers.Add(PBMessageID.SC_HallTick,SC_HallTickMapping);
    PBIDMapping SC_RetMatchGameMapping = new PBIDMapping(new SC_RetMatchGame_Handler(),typeof(SC_RetMatchGame));
    this.Handlers.Add(PBMessageID.SC_RetMatchGame,SC_RetMatchGameMapping);
    PBIDMapping SC_RetCancelMatchMapping = new PBIDMapping(new SC_RetCancelMatch_Handler(),typeof(SC_RetCancelMatch));
    this.Handlers.Add(PBMessageID.SC_RetCancelMatch,SC_RetCancelMatchMapping);
    PBIDMapping SC_EnterReadyRoomMapping = new PBIDMapping(new SC_EnterReadyRoom_Handler(),typeof(SC_EnterReadyRoom));
    this.Handlers.Add(PBMessageID.SC_EnterReadyRoom,SC_EnterReadyRoomMapping);
    PBIDMapping SC_SyncReadyRoomStateMapping = new PBIDMapping(new SC_SyncReadyRoomState_Handler(),typeof(SC_SyncReadyRoomState));
    this.Handlers.Add(PBMessageID.SC_SyncReadyRoomState,SC_SyncReadyRoomStateMapping);
    PBIDMapping SC_BackReadyRoomToHallMapping = new PBIDMapping(new SC_BackReadyRoomToHall_Handler(),typeof(SC_BackReadyRoomToHall));
    this.Handlers.Add(PBMessageID.SC_BackReadyRoomToHall,SC_BackReadyRoomToHallMapping);
    PBIDMapping SC_EnterGameSceneMapping = new PBIDMapping(new SC_EnterGameScene_Handler(),typeof(SC_EnterGameScene));
    this.Handlers.Add(PBMessageID.SC_EnterGameScene,SC_EnterGameSceneMapping);
    PBIDMapping SC_GameEndBackHallMapping = new PBIDMapping(new SC_GameEndBackHall_Handler(),typeof(SC_GameEndBackHall));
    this.Handlers.Add(PBMessageID.SC_GameEndBackHall,SC_GameEndBackHallMapping);
    PBIDMapping SC_CreateUnitsMapping = new PBIDMapping(new SC_CreateUnits_Handler(),typeof(SC_CreateUnits));
    this.Handlers.Add(PBMessageID.SC_CreateUnits,SC_CreateUnitsMapping);
    PBIDMapping SC_ServerUpdateMapping = new PBIDMapping(new SC_ServerUpdate_Handler(),typeof(SC_ServerUpdate));
    this.Handlers.Add(PBMessageID.SC_ServerUpdate,SC_ServerUpdateMapping);
    PBIDMapping SC_AbilityEventMapping = new PBIDMapping(new SC_AbilityEvent_Handler(),typeof(SC_AbilityEvent));
    this.Handlers.Add(PBMessageID.SC_AbilityEvent,SC_AbilityEventMapping);
    PBIDMapping SC_SyncUnitMapping = new PBIDMapping(new SC_SyncUnit_Handler(),typeof(SC_SyncUnit));
    this.Handlers.Add(PBMessageID.SC_SyncUnit,SC_SyncUnitMapping);
    PBIDMapping SC_CallUnitEventMapping = new PBIDMapping(new SC_CallUnitEvent_Handler(),typeof(SC_CallUnitEvent));
    this.Handlers.Add(PBMessageID.SC_CallUnitEvent,SC_CallUnitEventMapping);
    PBIDMapping SC_CallTriggerEventMapping = new PBIDMapping(new SC_CallTriggerEvent_Handler(),typeof(SC_CallTriggerEvent));
    this.Handlers.Add(PBMessageID.SC_CallTriggerEvent,SC_CallTriggerEventMapping);
    PBIDMapping SC_BehaviorOperationMapping = new PBIDMapping(new SC_BehaviorOperation_Handler(),typeof(SC_BehaviorOperation));
    this.Handlers.Add(PBMessageID.SC_BehaviorOperation,SC_BehaviorOperationMapping);
    
   }

   public PBIDMapping GetPBHandler(PBMessageID messageID) 
   {
       return this.Handlers[messageID];
   }
   
}
